<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use app\loginEd\middle\AuthMid;
use think\facade\Route;

Route::group("/api/user/public",function (){
    Route::rule("/:controller/:action",function (){
        $params = request()->param();
        $params['controller'] =$controller= ucfirst($params['controller']);
        $params['action']  =$action= cap2underline($params['action']);
        return app("app\\noLogin\\controller\\".$controller)->$action();
    });
});

Route::group("/api/user/auth",function (){
    Route::rule("/:controller/:action",function (){
        $params = request()->param();
        $params['controller'] =$controller= ucfirst($params['controller']);
        $params['action']  =$action= cap2underline($params['action']);
        return app("app\\loginEd\\controller\\".$controller)->$action();
    });
})->middleware(AuthMid::class);

Route::rule("/",function(){
   return R(false,[],'路由不存在');
});


